package com.boot.controller;


import com.boot.DAO.UserLoginDAO;
import com.boot.DAO.UserPageDAO;
import com.boot.result.Result;
import com.boot.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("user")
public class userController {
    @Autowired
    private UserService userService;

    @Operation(summary = "用户欢迎页")
    @GetMapping("hello")
    public String hello() {
        return "hello";
    }

    @Operation(summary = "登录")
    @PostMapping("login")
    public Result login(@RequestBody UserLoginDAO userLoginDAO) {
        return userService.loginUser(userLoginDAO);
    }

    @Operation(summary = "注册")
    @PostMapping("register")
    public Result register(@RequestBody UserLoginDAO userLoginDAO) {
        return userService.registerUser(userLoginDAO);
    }
}
